<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>线路管理</title>
		<link href="../css/mngMain.css" type="text/css" rel="stylesheet" />

		<script type="text/javascript" src="../js/jquery.js"></script>
		<script type="text/javascript">
    $(function(){
          $("#selectAllBox").click(function(){            
      			 $("input[@type=checkbox]",$("#topic_table")).each(function(){ 
                      $(this).attr({checked:true});                     
                 });
                 return false;
		  }); //end of allCheck
                   
          $("#deSelectAllBox").click(function(){
      			 $("input[@type=checkbox]",$("#topic_table")).each(function(){ 
                      if(this.checked)
                      {
                          $(this).attr({checked:false});
                      }
                      else
                      {
                      	   $(this).attr({checked:true});
                      }              
                 });
                 return false;
		  }); 
		  
		  $("#delSelected").click(function(){
		         var someSelectd = false;
      			 $("input[@type=checkbox]",$("#topic_table")).each(function(){ 
                      if(this.checked)
                      {
                          someSelectd=true;
                      }             
                 });
                 if(someSelectd)
                 {
                 	if (confirm('你确认要删吗？')) document.getElementById('topicListForm').submit();
                 }
                 else
                 {
                 	alert('您未选定任何行!');
                 }
                 return false;
		  }); 
	});	  
	function pageSelected(pageNum){
		document.getElementById('pageNum').value = pageNum;
		document.getElementById('searchForm').submit();
	}
</script>
	</head>

	<body>
		<div class="controlBox">
			<%@include file="../admin_top.jsp"%>
			<div class="mngMain">
				<div class="mngLeft">
					<%@include file="../admin_menu.jsp"%>
				</div>
				<div class="mngRight">
					<div class="mngRightContainer">
						<div class="mngRightContainerT">
							线路管理
						</div>
						<div class="mngRightContainerM">
							<form action="manageSeat.do" id="searchForm" method="post">
								<div style="float:right">线路：<select name="parId" style="width:250px" onchange="javascript:document.getElementById('searchForm').submit();"><logic:notEmpty name="lineList">
													
														<option value="-1">全部</option>					
													<logic:iterate id="line" name="lineList">								
														<option <logic:equal name="line" property="lineId" value="${parId}">selected="selected"</logic:equal> value="${line.lineId}">[${line.parentName}]&nbsp;(${line.serialNumber})${line.lineName}</option>
													</logic:iterate>
												</logic:notEmpty></select></div>
												<input type="hidden" name="pageNum" id="pageNum" />
							</form>
							
							<div>
								<form id="topicListForm" action="deleteSeat.do">
									<input type="hidden" name="parId" value="${parId}" />
									<input type="hidden" name="pageNum" value="${pageNum}" />
									<table class="editUser" id="topic_table" cellpadding="0"
										cellspacing="1">										
												<tr>
													<th width="5%">&nbsp;</th>
													<th width="15%">
														线路编号
													</th>
													<th width="35%">
														日期
													</th>
													<th width="25%">
														余位（点击修改）
													</th>
													<th width="20%">
														操作
													</th>
												</tr>
										<logic:notEmpty name="seatList">
											<logic:iterate id="seat" name="seatList">
												<tr>
														<td>
															<input type="checkbox" name="delId"
																value="${seat.id }" />
														</td>
														<td>
															<logic:notEmpty name="seat" property="parentSerialNumber"><a href="preEditLine.do?id=${seat.parentId }">[${seat.parentSerialNumber}]</a></logic:notEmpty>
														</td>
														<td>
															<bean:write name="seat" property="date" format="yyyy-MM-dd" />
														</td>
														<td>
															<input style="text-align:center;" id="remnant${seat.id}" readonly="readonly" type="text" name="remant" value="${seat.remnant}" />
														</td>
														<td>
															<a
																href="deleteSeat.do?delId=${seat.id}&parId=${parId}&pageNum=${pageNum}"
																onclick="return confirm('你确认要删除吗？')">删除</a>
													</td>
												</tr>
											</logic:iterate>
										</logic:notEmpty>
									</table>
								</form>
								<table class="changePage" cellspacing="1">
									<tr>
										<td>
											<a href="null#" id="selectAllBox">全选</a><a href="null#"
												id="deSelectAllBox">反选</a><a href="#" id="delSelected">删除选中</a>
											<a href="preAddSeat.do">添加新余位信息</a>&nbsp;&nbsp;第<select onchange="javascript:pageSelected(this.value);"><%for(int i=1;i<=new Integer(String.valueOf(request.getAttribute("totlePage")));i++){ %><option <%if(i==new Integer(String.valueOf(request.getAttribute("pageNum")))){%>selected="selected"<%}%> value="<%=i %>"><%=i %></option><%} %></select>页 
										</td>
									</tr>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="mngBottom">
				<div class="mngLine"></div>
			</div>
		</div>
	</body>
</html>
